package com.bootdo.hotel.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.hotel.dao.HotelRoomDao;
import com.bootdo.hotel.domain.HotelRoom;
import com.bootdo.hotel.service.HotelRoomService;



@Service
public class HotelRoomServiceImpl implements HotelRoomService {
	@Autowired
	private HotelRoomDao hotelRoomDao;
	
	@Override
	public HotelRoom get(Long id){
		return hotelRoomDao.get(id);
	}

	@Override
	public HotelRoom getHotelIdAndName(Long hotelId, String name) {
		return hotelRoomDao.getHotelIdAndName(hotelId,name);
	}


	@Override
	public List<HotelRoom> list(Map<String, Object> map){
		return hotelRoomDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return hotelRoomDao.count(map);
	}
	
	@Override
	public int save(HotelRoom hotelRoom){
	
		if(hotelRoom.getId() != null) {
			return hotelRoomDao.update(hotelRoom);
		}else {
			return hotelRoomDao.save(hotelRoom);
		}		
	
		
	}
	
	@Override
	public int update(HotelRoom hotelRoom){
		return hotelRoomDao.update(hotelRoom);
	}
	
	@Override
	public int remove(Long id){
		return hotelRoomDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return hotelRoomDao.batchRemove(ids);
	}
	
}
